package controllers

import (
	"github.com/fogleman/gg"
	"bytes"
	"image/png"
)

type ExampleController struct {
	BaseController
}

//image转二进制输出到浏览器
func (this *ExampleController)  Image(){
	dc := gg.NewContext(1000,1000)
	dc.DrawCircle(500,500,400)
	dc.SetRGB(50,0,0)
	dc.Fill()
	this.Ctx.ResponseWriter.Header().Set("Content-Type","image/png")
	emptyBuff := bytes.NewBuffer(nil)
	png.Encode(emptyBuff, dc.Image())
	send_s3 := emptyBuff.Bytes()
	this.Ctx.ResponseWriter.Write([]byte(send_s3))
}



